package cn.xo68.sample.hazelcastdemo.controller;

import com.hazelcast.core.HazelcastInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;

/**
 * Created by nnsword on 2018/5/15.
 */
@RestController
public class HomeController {

    private  static  final  String Key_test="cn.xo68.test";

    @Autowired
    private Map<String,String> hazelcastMap;

    @GetMapping(value = {"/",""})
    public Map<String,String> index(){
        Map<String,String> map= hazelcastMap;
        Random rnd=new Random();
        int rndint=rnd.nextInt(1000);
        map.put("key"+String.valueOf(rndint),"value"+String.valueOf(rndint));
        return map;
    }
}
